package com.xckj.cycling.utils

import android.view.LayoutInflater
import android.widget.Toast
import com.xckj.cycling.BuildConfig
import com.xckj.cycling.context.AppContext
import com.xckj.cycling.databinding.TransientNotificationBinding

object ToastUtils {

    @JvmStatic
    fun showToast(charSequence: CharSequence?) {
        charSequence ?: return
        val view = AppContext.globalContext().let {
            val l = LayoutInflater.from(it)
            TransientNotificationBinding.inflate(l)
        }
        val toast = Toast(AppContext.globalContext())
        toast.view = view.root
        view.message.text = charSequence
        toast.show()
    }

    @JvmStatic
    fun debug(charSequence: CharSequence?) {
//        if (BuildConfig.DEBUG) {
//            showToast("（仅测试可见的Toast: ）$charSequence")
//        }
    }
}